<?php

/**
 * * Checking permission functions
 * @author DuongNV
 * @copyright Tan MA JSC
 * @category common function
 * @version 1.1
 */

/**
 * Check login function. If do not login, the document with change to login page
 */
function checkUserLogin() {

    if (! isset( $_SESSION)) {
        changeDocumentURL( SITE_ADMIN . "login.php");
    }
    
    if (! isset( $_SESSION[SESSION_USERNAME]) || empty( $_SESSION[SESSION_USERNAME]) || ! isset( $_SESSION[SESSION_ROLE]) || empty( $_SESSION[SESSION_ROLE])) {
        changeDocumentURL( SITE_ADMIN . "login.php");
    }
}

/**
 * Check access permission for one action of one actor
 * @param string $action the action actor want to do
 * @return boolean
 */
function checkAccessPermision($role, $controller, $action) {

    return true;
}

?>
